<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // math.trunc() 去掉小数
    var num = 3.14;
    console.log(Math.trunc(num));

    // math.sign() 判断正负 正数1，负数-1
    var num1 = 20;
    console.log(Math.sign(num1));

    // math.sqrt() 平方根
    var num2 = 4;
    console.log(Math.sqrt(num2));

    // math.cbrt() 立方根
    var num3 = 27;
    console.log(Math.cbrt(num3));

    // math.hypot() 平方和的平方根
    console.log(Math.hypot(2,3));
    // 2*2+3*3=13  的平方根


    // number.isFinite() 有限的数true  无限的数false
    console.log(Number.isFinite(12345));    //true
    console.log(Number.isFinite(Math.pow(2,1024)));     //false

    // number.isNaN() 判断是不是NaN
    console.log(Number.isNaN(3));  //false

    // number.isInteger判断是否是整数
    var num1=3.14;
    console.log(Number.isInteger(num)); //false

    // number.parseInt() 取整&去掉数字后的单位
    var num2 = "4.251646";
    console.log(Number.parseInt(num2));
    var num3 = "100px";
    console.log(Number.parseInt(num3));
    console.log(Number.parseFloat===parseInt);// flase
</script>